<template>
  <div class="youke">
    <Navs left></Navs>
    <Main>
      <template slot="main">
        <van-cell
          :title="item.title"
          is-link
          :to="'/guide/detail?id='+item.id"
          v-for="(item,inx) in ret"
          :key="inx"
        />

      </template>
    </Main>
  </div>
</template>

<script type="text/ecmascript-6">
import { news } from "@/api";
export default {
  //接收父级传递的参数
  props: [],
  //监听数据变化
  watch: {},
  data() {
    return {
      page: 1,
      ret: []
    };
  },
  //实例初始化之前触发事件
  beforeCreate() {},
  //实例化之后触发事件
  created() {
    this.getlist();
  },
  //实时监控data参数数据变化
  computed: {},
  //模板组件
  components: {},
  //执行方法
  methods: {
    getlist() {
      news.newslist({ type: 3, page: this.page }).then(res => {
        if (res.code == 1000) {
          if (Number(res.count) != 0) {
            this.ret = [...this.ret, ...res.result];
          }else{
            this.ret = [];
          }
        }
      });
    }
  },
  mounted() {}
  //路由退出时候调用
  //beforeRouteLeave(to, from, next){next()}
};
</script>

<style scoped lang="less">
</style>
